package com.mt.api.modules.manager.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mt.api.core.page.PageFactory;
import com.mt.api.modules.domain.StockTaking;
import com.mt.api.modules.domain.bo.StockTakingPageBo;
import com.mt.api.modules.manager.IStockTakingManager;
import com.mt.api.modules.mapper.StockTakingMapper;
import org.springframework.stereotype.Component;

/**
 * @Author: plover
 * @Date: 2022-04-30
 * @Description:
 */
@Component
public class StockTakingManagerImpl extends ServiceImpl<StockTakingMapper, StockTaking> implements IStockTakingManager {


    @Override
    public Page<StockTaking> getStockTakingPage(StockTakingPageBo bo) {
        Page page = PageFactory.defaultPage(bo);
        LambdaQueryWrapper<StockTaking> wrapper = Wrappers.lambdaQuery();
        wrapper.orderByDesc(StockTaking::getId);
        page = baseMapper.selectPage(page, wrapper);
        return page;
    }
}
